home *** CD-ROM | disk | FTP | other *** search
- # File: InterruptSafeDebug.s
- #
- # Contains: Atomic add for systems without DriverServicesLib.
- #
- # Written by: Quinn
- #
- # Copyright: Copyright © 1998 by Apple Computer, Inc., all rights reserved.
- #
- # You may incorporate this Apple sample source code into your program(s) without
- # restriction. This Apple sample source code has been provided "AS IS" and the
- # responsibility for its operation is yours. You are not permitted to redistribute
- # this Apple sample source code as "Apple sample source code" after having made
- # changes. If you're going to re-distribute the source, we require that you make
- # it clear in the source that the code was descended from Apple sample source
- # code, but that you've made changes.
- #
- # Change History (most recent first):
- #
- # <4> 23/11/98 Quinn Fix header (again).
- # <3> 23/11/98 Quinn Testing CWProjector's header.
- # <2> 23/11/98 Quinn Fix header.
- # <1> 23/11/98 Quinn First checked in.
-
- # WARNING
- # Do not use this routine on a machine that has a real implementation
- # of AddAtomic. If the machine has DriverServicesLib (or InterfaceLib
- # from Mac OS 8.5 or later), use the AddAtomic implementation in
- # preference to this implementation.
-
- # extern UInt32 AddAtomicForNonDSL(UInt32 amount, UInt32 *value);
-
- csect .AddAtomicForNonDSL{PR}
- export .AddAtomicForNonDSL{PR}
-
- AddAtomicForNonDSL:
- @again:
- lwarx r5,r0,r4 # fetch the original
- add r5,r5,r3 # create updated value
- stwcx. r5,r0,r4 # try storing back
- bne- @again # if store didn't happen, try again
- sync
- blr # result remains in r3
-